#include <iostream>
#include <vector>

using namespace std;

vector<int> temp1(2,1);
vector<int> temp2;

int getval(int i, int j)
{
    if(j==0 || j==i-1){return 1;}
    return temp1[j] + temp1[j-1];
}

int main()
{
    int n;
    bool ex = false;
    cin>>n;
    int i=3;
    int num = 3;
    while(true)
    {
        for(int j=0;j<i;j++)
        {
            temp2.push_back(getval(i,j));
            num++;
            if(temp2.back()==n){ex=true;break;}
        }
        if(ex){break;}
        temp1 = temp2;
        temp2.clear();
        i++;
    }
    cout<<num;
}
